package com.msmall.community.play.cases.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.msmall.base.model.BaseObject;
import com.msmall.community.user.model.UserInfo;

/**
 * 用户正在玩的Case
 * @author zhzy
 *
 */
@Entity
@Table(name="play_cases_user_cases")
public class UserCases extends BaseObject{

	private static final long serialVersionUID = -4047538977064844497L;

	public static final Integer RESULT_SUCCESS = 1;
	
	public static final Integer RESULT_ERROR = -1;
	
	public static final Integer RESULT_IN = 0;
	@Id
	@Column(name="user_cases_id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;

	/**
	 * 用户目前玩的进度。场景ID
	 */
	@Column(name="scenario_id")
	private Long scenarioId;
	
	/**
	 * 一共产生的有效步骤数
	 */
	@Column(name="valid_step")
	private Integer validStep;
	
	/**
	 * 一共产生的无效步骤数
	 */
	@Column(name="invalid_step")
	private Integer invalidStep;
	
	/**
	 * 此CASE的结果，1用户完成。-1用户失败.0用户进行中
	 */
	@Column(name="result")
	private Integer result;

	@Column(name="enabled")
	private Short enabled;
	
	/**
	 * 用户玩的次数
	 */
	@Column(name="round")
	private Integer round;
	
	@Column(name="create_time")
	@Temporal(TemporalType.TIMESTAMP)
	private Date createTime;

	/**
	 * 游戏者
	 */
	@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="user_id")
	private UserInfo user;

	/**
	 * 用户正在玩的Cases ID
	 */
	@ManyToOne(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY)
	@JoinColumn(name="cases_id")
	private Cases cases;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getScenarioId() {
		return scenarioId;
	}

	public void setScenarioId(Long scenarioId) {
		this.scenarioId = scenarioId;
	}

	public Integer getValidStep() {
		return validStep;
	}

	public void setValidStep(Integer validStep) {
		this.validStep = validStep;
	}

	public Integer getInvalidStep() {
		return invalidStep;
	}

	public void setInvalidStep(Integer invalidStep) {
		this.invalidStep = invalidStep;
	}

	public Integer getResult() {
		return result;
	}

	public void setResult(Integer result) {
		this.result = result;
	}

	public Short getEnabled() {
		return enabled;
	}

	public void setEnabled(Short enabled) {
		this.enabled = enabled;
	}

	public Integer getRound() {
		return round;
	}

	public void setRound(Integer round) {
		this.round = round;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public UserInfo getUser() {
		return user;
	}

	public void setUser(UserInfo user) {
		this.user = user;
	}

	public Cases getCases() {
		return cases;
	}

	public void setCases(Cases cases) {
		this.cases = cases;
	}

	public boolean equals(Object o) {
		return false;
	}

	public int hashCode() {
		return 0;
	}

	public String toString() {
		return null;
	}

}